package com.igeekhome.units;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultBean {
    private static final Integer SUCCESS_CODE=200;
    private static final Integer FAIL_CODE=500;

    private Integer code;
    private String msg;
    private Object data;



    public static ResultBean ok(){
        return new ResultBean(ResultBean.SUCCESS_CODE,"成功",null);
    }

    public static ResultBean ok(Object list){
        return new ResultBean(ResultBean.SUCCESS_CODE,"成功",list);
    }

    public static ResultBean fail(String msg){
        return new ResultBean(ResultBean.SUCCESS_CODE,msg,null);
    }

    public static ResultBean common(Integer code,String msg,Object object){
        return new ResultBean(code,msg,object);
    }


}
